Skip to content

Anouar - #39

Merged
mousanouar merged 8 commits into
mainfrom
Anouar
Jun 12, 2026
Merged

Anouar#39
mousanouar merged 8 commits into
mainfrom
Anouar

Conversation

@mousanouar

Copy link
Copy Markdown
Member

No description provided.

… Now corrected. The RPA examples are still broken and need to be looked at.
GPU-accelerated counterparts to the CPU solvers, for systems/Ncheb too
large to run on CPU. Chebyshev recurrence, MPO/MPS products, Hadamard
products, projections, and real-space/QFT sampling run on GPU (NDTensors
CUDA backend, ComplexF32); setup, Tucker SVDs, k-/spatial-group
bookkeeping, and final scalar accumulation stay on CPU.

Entry points:
- get_conductivity_ward_gpu / get_conductivity_cheb2d_gpu - sigma(omega)
- get_bands_gpu - A(k,omega) band structure
- get_ldos_spatial_gpu - A(r,omega) real-space LDOS, with :point/:block
  sampling and sublattice :average/:resolve modes
- get_dos_stochastic_gpu - stochastic-trace DOS
- get_exciton_ldos_spatial_gpu - A(X,omega) exciton LDOS
- get_C_gpu - real-space Chern marker
- scf_magnetic_hubbard_gpu, get_scf_magnetization_gpu,
  get_scf_bands_gpu - collinear magnetic Hubbard SCF loop and
  post-hoc magnetization/band diagnostics

CUDA stays an optional dependency: CUDA is resolved at runtime via
Base.loaded_modules (no `using CUDA` at load time, not in Project.toml),
so including this file does not force CUDA on users who never call
*_gpu functions.
…F maps

Adds a single planner used by every spatial sampler (eval_mps_spatial here,
plus get_ldos_spatial, get_ldos_spatial_gpu, get_scf_magnetization_gpu) so
they share one geometry-aware notion of "where to sample" and "how to
reduce the cells under each pixel."

- spatial_sampling_plan(L; ...) - builds sample centers/groups for a
  2^Lx x 2^Ly system. Supports two reduction modes:
    - :point (default) - sample/box-average at grid positions; cheap but
      aliases thin features on a coarse grid.
    - :block - gap-free coarse-graining: integrate each block by tracing
      out the within-block position bits (cost independent of block size),
      for large-scale maps of thin edge/domain-wall features.
  Also decides whether multi-atom unit cells are sublattice-:resolved
  (per-atom columns) or :averaged (one value per unit cell), or :auto
  based on sampling resolution. Extensive docstring documents all three
  procedures with usage examples.

- _eval_block_mps(A, ixp, iyp, a, b, Lx, Ly) - CPU block-integration MPS
  evaluator backing reduce=:block.

- eval_mps_spatial(A; ...) - new spatial sampler for profile MPS (e.g. SCF
  density/magnetization), built on spatial_sampling_plan; same
  num_x/num_avg/x_groups/box_half API as get_ldos_spatial but evaluates via
  eval_mps directly (no KPM recursion).
spatial_sampling_plan, requires num_x/num_y powers of two, :mpo mode
only) alongside the existing :point sampling, plus sublattice=:resolve
/:average/:auto for geometry-aware sublattice handling. New num_y,
grid, xwin, ywin, box_half kwargs enable 2D grid/window sampling.
accumulate_Tn! is simplified via a new spatial_vals_cpu closure that
unifies point vs. block reduction across resolved/averaged sublattice
layouts. Docstring rewritten to document the sampling procedures,
sublattice decision logic, and resulting shapes.

get_dos_stochastic: add dos_weighting=:trace (default, unchanged
behavior) / :sample (raw sampled signal before sector-size weighting,
for inspecting exciton bound peaks) and HODC reconstruction support
via new eta/m_order kwargs. New _dos_weight_matrix helper centralizes
the per-kernel weight matrix and normalization denom, replacing the
old _kpm_weight_matrix + hardcoded pi^2*Ncheb norm, and is shared with
the new exciton LDOS path.

Exciton LDOS: replace the cache-based get_exciton_ldos (now internal
_get_exciton_ldos_cached, kept for legacy use) with
get_exciton_ldos_spatial, an online MPS Chebyshev recursion over one
or many bound-pair positions |X,X> with no cache stored on H. New
public get_exciton_ldos (scalar and vector-omega forms) wrap
get_exciton_ldos_spatial for a single position. Update the Pathway
2/4 overview at the top of the file to match.

Minor: fix "HODC" expansion (High-Order Damping Correction ->
Higher-Order Delta Chebyshev) in get_ldos_hodc_from_mun's docstring.
@mousanouar

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Done in commit 91c0814: merged origin/main into this branch and resolved the merge conflicts.

@mousanouar
mousanouar merged commit 4a89384 into main Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants